{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 利用CNN卷积神经网络实现手写体数字识别"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [],
   "source": [
    "from __future__ import absolute_import, division, print_function, unicode_literals\n",
    "import tensorflow as tf\n",
    "from tensorflow.keras import datasets, layers, models\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 一、数据读取 & 归一化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "(train_images, train_labels), (test_images, test_labels) = datasets.mnist.load_data()\n",
    "\n",
    "train_images = train_images.reshape((60000, 28, 28, 1))\n",
    "test_images = test_images.reshape((10000, 28, 28, 1))\n",
    "# 特征缩放[0, 1]区间 \n",
    "train_images, test_images = train_images / 255.0, test_images / 255.0"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 二、构建卷积层 & 池化层"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Model: \"sequential\"\n",
      "_________________________________________________________________\n",
      "Layer (type)                 Output Shape              Param #   \n",
      "=================================================================\n",
      "conv2d (Conv2D)              (None, 26, 26, 32)        320       \n",
      "_________________________________________________________________\n",
      "max_pooling2d (MaxPooling2D) (None, 13, 13, 32)        0         \n",
      "_________________________________________________________________\n",
      "conv2d_1 (Conv2D)            (None, 11, 11, 64)        18496     \n",
      "_________________________________________________________________\n",
      "max_pooling2d_1 (MaxPooling2 (None, 5, 5, 64)          0         \n",
      "_________________________________________________________________\n",
      "conv2d_2 (Conv2D)            (None, 3, 3, 64)          36928     \n",
      "=================================================================\n",
      "Total params: 55,744\n",
      "Trainable params: 55,744\n",
      "Non-trainable params: 0\n",
      "_________________________________________________________________\n"
     ]
    }
   ],
   "source": [
    "model = models.Sequential()\n",
    "model.add(layers.Conv2D(32, (3, 3), activation='relu', input_shape=(28, 28, 1)))\n",
    "model.add(layers.MaxPooling2D((2, 2)))\n",
    "model.add(layers.Conv2D(64, (3, 3), activation='relu'))\n",
    "model.add(layers.MaxPooling2D((2, 2)))\n",
    "model.add(layers.Conv2D(64, (3, 3), activation='relu'))\n",
    "model.summary() # 显示模型的架构"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 三、构建全连接层 & 输出层"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Model: \"sequential\"\n",
      "_________________________________________________________________\n",
      "Layer (type)                 Output Shape              Param #   \n",
      "=================================================================\n",
      "conv2d (Conv2D)              (None, 26, 26, 32)        320       \n",
      "_________________________________________________________________\n",
      "max_pooling2d (MaxPooling2D) (None, 13, 13, 32)        0         \n",
      "_________________________________________________________________\n",
      "conv2d_1 (Conv2D)            (None, 11, 11, 64)        18496     \n",
      "_________________________________________________________________\n",
      "max_pooling2d_1 (MaxPooling2 (None, 5, 5, 64)          0         \n",
      "_________________________________________________________________\n",
      "conv2d_2 (Conv2D)            (None, 3, 3, 64)          36928     \n",
      "_________________________________________________________________\n",
      "flatten (Flatten)            (None, 576)               0         \n",
      "_________________________________________________________________\n",
      "dense (Dense)                (None, 64)                36928     \n",
      "_________________________________________________________________\n",
      "dense_1 (Dense)              (None, 10)                650       \n",
      "=================================================================\n",
      "Total params: 93,322\n",
      "Trainable params: 93,322\n",
      "Non-trainable params: 0\n",
      "_________________________________________________________________\n"
     ]
    }
   ],
   "source": [
    "model.add(layers.Flatten())  # 显示模型的架构\n",
    "model.add(layers.Dense(64, activation='relu'))\n",
    "model.add(layers.Dense(10, activation='softmax'))\n",
    "model.summary() # 显示模型的架构"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 四、选择优化器 & 损失函数 & 训练并验证网络"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "WARNING:tensorflow:From D:\\Anaconda3\\lib\\site-packages\\tensorflow\\python\\ops\\math_grad.py:1250: add_dispatch_support.<locals>.wrapper (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version.\n",
      "Instructions for updating:\n",
      "Use tf.where in 2.0, which has the same broadcast rule as np.where\n",
      "Train on 60000 samples, validate on 10000 samples\n",
      "Epoch 1/5\n",
      "60000/60000 [==============================] - 8s 130us/sample - loss: 0.1542 - accuracy: 0.9523 - val_loss: 0.0532 - val_accuracy: 0.9838\n",
      "Epoch 2/5\n",
      "60000/60000 [==============================] - 6s 95us/sample - loss: 0.0449 - accuracy: 0.9860 - val_loss: 0.0337 - val_accuracy: 0.9896\n",
      "Epoch 3/5\n",
      "60000/60000 [==============================] - 6s 94us/sample - loss: 0.0327 - accuracy: 0.9897 - val_loss: 0.0311 - val_accuracy: 0.9904\n",
      "Epoch 4/5\n",
      "60000/60000 [==============================] - 6s 94us/sample - loss: 0.0257 - accuracy: 0.9923 - val_loss: 0.0368 - val_accuracy: 0.9881\n",
      "Epoch 5/5\n",
      "60000/60000 [==============================] - 6s 94us/sample - loss: 0.0188 - accuracy: 0.9941 - val_loss: 0.0394 - val_accuracy: 0.9867\n"
     ]
    }
   ],
   "source": [
    "model.compile(optimizer='adam',\n",
    "              loss='sparse_categorical_crossentropy',\n",
    "              metrics=['accuracy'])\n",
    "\n",
    "history = model.fit(train_images, train_labels, epochs=5,\n",
    "                    validation_data=(test_images, test_labels))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 五、测试网络"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "10000/10000 [==============================] - 0s 45us/sample - loss: 0.0394 - accuracy: 0.9867\n"
     ]
    }
   ],
   "source": [
    "test_loss, test_acc = model.evaluate(test_images, test_labels)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 六、将训练集与验证集准确率可视化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.legend.Legend at 0x178da1b52e8>"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZEAAAEKCAYAAADTgGjXAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAgAElEQVR4nO3deXxU9b3/8deH7AskARIIm+yLAlEMoKKI0GutxaVuaK1V3G79qXXHFvdba7W1iz682mJdq9YiyK16W61QFXsVLSirKPsStoQtC9mT7++PcxICJGEYMplk5v18POYxc07OzHwzyrzz/X7P+X7MOYeIiEgwOoS7ASIi0n4pREREJGgKERERCZpCREREgqYQERGRoClEREQkaCELETN73szyzWx5g32dzex9M1vt32f4+83MnjSzNWa21MxG+fuHmNkiM1tiZif7+2LNbK6ZJYeq7SIiEphQ9kReBM46aN9PgHnOuUHAPH8b4DvAIP92PfCMv/8//WMuAu70990A/Mk5VxqylouISEBCFiLOufnA7oN2nwe85D9+CTi/wf6XnWcBkG5m2UAVkAQkA1Vmlg6cA7wcqnaLiEjgYlv5/bo557YBOOe2mVmWv78nsLnBcXn+vv/GC4wEvF7J/cDP3WEuszez6/F6NKSkpJw4dOjQFv0lREQi3aJFi3Y65zIPd1xrh0hTrJF9zjm3CZgAYGYDgR7A12b2JyAeuM85t6qRJ84AZgDk5ua6hQsXhqrdIiIRycw2BnJca5+dtcMfpsK/z/f35wG9GxzXC9h60HN/Dt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LLLVx//fW8++67TJ8+nZqaGrp27cq8efMoKSnh5ptvZuHChZgZDzzwABdeeCGpqamUlJQAMGvWLN555x1efPFFrrrqKjp37syXX37JqFGjmDJlCrfeeitlZWUkJSXxwgsvMGTIEGpqarj77rt57733MDOuu+46jj32WJ566inmzJkDwPvvv88zzzzDm2++2aKfUUtSiIhIVHr++efp3LkzZWVljB49mvPOO4/rrruO+fPn069fP3bv3g3Az372M9LS0li2bBkAe/bsOexrr1q1irlz5xITE0NRURHz588nNjaWuXPnMn36dGbPns2MGTNYv349X375JbGxsezevZuMjAxuvPFGCgoKyMzM5IUXXmDq1Kkh/RyOlkJERMImkB5DqDz55JP1f/Fv3ryZGTNmMH78+PrrJTp37gzA3Llzef311+ufl5GRcdjXvvjii4mJiQGgsLCQK6+8ktWrV2NmVFVV1b/uj370I2JjYw94vyuuuIJXXnmFqVOn8umnn/Lyyy+30G8cGgoREYk6H374IXPnzuXTTz8lOTmZCRMmkGaDXVgAAAtESURBVJOTwzfffHPIsc65Rk+Dbbjv4OssUlJS6h/fd999nHHGGcyZM4cNGzYwYcKEZl936tSpnHPOOSQmJnLxxRfXh0xbpYl1EYk6hYWFZGRkkJyczNdff82CBQuoqKjgo48+Yv369QD1w1lnnnkmTz31VP1z64azunXrxsqVK6mtra3v0TT1Xj179gTgxRdfrN9/5pln8vvf/75+8r3u/Xr06EGPHj14+OGHueqqq1rsdw4VhYiIRJ2zzjqL6upqRo4cyX333cdJJ51EZmYmM2bM4IILLiAnJ4cpU6YAcO+997Jnzx6GDx9OTk4OH3zwAQCPPvookydPZuLEiWRnZzf5XtOmTeOnP/0p48aNo6ampn7/tddeS58+fRg5ciQ5OTm89tpr9T+7/PLL6d27N8ce2/bLeptzLtxtCKnc3Fy3cOHCcDdDRHwrV65k2LBh4W5Gm3bTTTdxwgkncM0117TK+zX238TMFjnncg/33LY92CYiEmVOPPFEUlJS+PWvfx3upgREISIi0oYsWrQo3E04IpoTERGRoClEREQkaAoREREJmkJERESCphAREZGgKURERA4jNTU13E1os3SKr4iEz99/AtuXtexrdh8B33m0ZV+zjaiurm5za2mpJyIiUefuu+/m6aefrt9+8MEHeeihh5g0aRKjRo1ixIgR/PWvfw3otUpKSpp83ssvv1y/rMkVV1wBwI4dO/je975HTk4OOTk5fPLJJ2zYsIHhw4fXP+/xxx/nwQcfBGDChAlMnz6d008/nSeeeIK3336bsWPHcsIJJ/Ctb32LHTt21Ldj6tSpjBgxgpEjRzJ79myee+45brvttvrXffbZZ7n99tuD/twa5ZyL6NuJJ57oRKTt+Oqrr8LdBPfFF1+48ePH128PGzbMbdy40RUWFjrnnCsoKHADBgxwtbW1zjnnUlJSmnytqqqqRp+3fPlyN3jwYFdQUOCcc27Xrl3OOecuueQS99vf/tY551x1dbXbu3evW79+vTvuuOPqX/NXv/qVe+CBB5xzzp1++unuhhtuqP/Z7t2769v17LPPuttvv90559y0adPcLbfccsBxJSUlrn///q6ystI559zJJ5/sli5desjv0Nh/E2ChC+A7tm31i0REWsEJJ5xAfn4+W7dupaCggIyMDLKzs7ntttuYP38+HTp0YMuWLezYsYPu3bs3+1rOOaZPn37I8/75z39y0UUX0bVrV2B/vZB//vOf9TVCYmJiSEtLO2yhq7rFIAHy8vKYMmUK27Zto7Kysr7+SVN1TyZOnMg777zDsGHDqKqqYsSIEUf4aTVPISIiUemiiy5i1qxZbN++nUsvvZRXX32VgoICFi1aRFxcHH379j2kTkhjmnqea6JeSGNiY2Opra2t326uPsnNN9/M7bffzrnnnsuHH35YP+zV1Ptde+21PPLIIwwdOjQkVRI1JyIiUenSSy/l9ddfZ9asWVx00UUUFhaSlZVFXFwcH3zwARs3bgzodZp63qRJk5g5cya7du0C9tcLmTRpEs888wwANTU1FBUV0a1bN/Lz89m1axcVFRW88847zb5fXX2Sl156qX5/U3VPxo4dy+bNm3nttde47LLLAv14AqYQEZGodNxxx1FcXEzPnj3Jzs7m8ssvZ+HCheTm5vLqq68ydOjQgF6nqecdd9xx3HPPPZx++unk5OTUT2g/8cQTfP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/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(history.history['accuracy'], label='accuracy')\n",
    "plt.plot(history.history['val_accuracy'], label = 'val_accuracy')\n",
    "plt.xlabel('Epoch')\n",
    "plt.ylabel('Accuracy')\n",
    "plt.ylim([0.94, 1])\n",
    "plt.xlim([0, 4])\n",
    "plt.yticks([0.94, 0.96, 0.98, 1],\n",
    "  ['94%', '96%', '98%', '100%'])\n",
    "plt.xticks([0, 1, 2, 3, 4])\n",
    "plt.legend(loc='lower right')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 七、将训练集与验证集损失函数值可视化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.legend.Legend at 0x178da4b4080>"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEKCAYAAADjDHn2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAgAElEQVR4nO3deXxcdb3/8dcnyWRPmqVJ9zbdC21p0FBRaL14vYALa5EWARVRfuIVaAUE5SIoIFyXUhcuV/QieAFpoaBsglxESrUCaUl3KG1pS7om6ZKl2fP9/TEnybSkmUmznMzk/Xw85jEzZ86cfGag5z3f8/2e7zHnHCIiIp2J87sAERHp/xQWIiISlsJCRETCUliIiEhYCgsREQlLYSEiImH1WliY2Sgze9XMNprZejO7zlueY2Yvm9l73n22t3yOt97rZpbrLRtvZo/3Vo0iIhIZ663zLMxsGDDMObfKzDKAlcD5wFeA/c65e8zsZiDbOXeTmf0DOAuYByQ7535pZn8Avu+ce69XihQRkYj0WsvCObfbObfKe1wFbARGAOcBD3urPUwwQABagCQgFWg0s1nAbgWFiIj/Evrij5hZAXAy8AYwxDm3G4KBYmb53mo/AF4CdgGXAUsItjI62+5VwFUAaWlpH50yZUpvlC8iErNWrlxZ7pzLC7derx2GavsDZunAa8BdzrmnzOygcy4r5PUDzrnso97zZSCLYLjcABwArnPOHT7W3ykqKnLFxcW98hlERGKVma10zhWFW69XR0OZWQBYCjzqnHvKW7zX689o7dfYd9R7UoEvA/8F3A18lWB/x6W9WauIiBxbb46GMuB/gI3OuYUhLz1DMAzw7v901Fu/A/zcOdcIpACOYH9Gam/VKiIinevNPovTgMuBtWZW4i37HnAPsMTMrgR2AF9ofYOZDQeKnHO3e4t+BvwTOEh7R7iIiPSxXgsL59xywI7x8r8e4z27gM+HPH8CeKLnqxORWNHY2EhpaSl1dXV+l9KvJScnM3LkSAKBwHG9v09GQ4mI9JbS0lIyMjIoKCggePRbjuaco6KigtLSUsaOHXtc29B0HyIS1erq6sjNzVVQdMLMyM3N7VbrS2EhIlFPQRFed78jhYWIiISlsBAR6ab09HS/S+h1CgsREQlLYSEi0kOcc9x4441MmzaN6dOns3jxYgB2797N7NmzKSwsZNq0abz++us0Nzfzla98pW3de++91+fqO6ehsyISM37w7Ho27Krs0W2eODyT286ZGtG6Tz31FCUlJaxevZry8nJOOeUUZs+ezWOPPcZZZ53FLbfcQnNzM4cPH6akpISdO3eybt06AA4ePNijdfc0tSxERHrI8uXLueSSS4iPj2fIkCF88pOf5K233uKUU07hd7/7Hbfffjtr164lIyODcePGsXXrVq655hpefPFFMjMz/S6/U2pZiEjMiLQF0FuONYv37NmzWbZsGc8//zyXX345N954I1/60pdYvXo1L730Evfddx9LlizhwQcf7OOKI6eWhYhID5k9ezaLFy+mubmZsrIyli1bxsyZM9m+fTv5+fl8/etf58orr2TVqlWUl5fT0tLCnDlzuOOOO1i1apXf5XdKLQsRkR5ywQUXsGLFCmbMmIGZ8eMf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Il2T4l2prdWLzrnW4bNJZvYGwR9hl3jLrgUeNLMbgTLgCm/5dcAD3qy+zQSDY3evVy9ynNRnIdIDvD6LIudcud+1iPQGHYYSEZGw1LIQEZGw1LIQEZGwFBYiIhKWwkJERMJSWIiISFgKCxERCev/A+s99qBKyIqfAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(history.history['loss'], label='loss')\n",
    "plt.plot(history.history['val_loss'], label = 'val_loss')\n",
    "plt.xlabel('Epoch')\n",
    "plt.ylabel('Loss')\n",
    "plt.ylim([0, 0.2])\n",
    "plt.xlim([0, 4])\n",
    "plt.yticks([0, 0.05, 0.1, 0.15, 0.2],\n",
    "  ['0%', '5%', '10%', '15%','20%'])\n",
    "plt.xticks([0, 1, 2, 3, 4])\n",
    "plt.legend(loc='upper right')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 八、展示测试集前10张图片并可视化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([7, 2, 1, 0, 4, 1, 4, 9, 5, 9], dtype=int64)"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "prediction = model.predict_classes(test_images)\n",
    "prediction[:10]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 定义图片可视化\n",
    "def plot_labels_prediction(images, labels, prediction, idx, num=10):\n",
    "    fig = plt.gcf()\n",
    "    fig.set_size_inches(12, 14) \n",
    "    if num > 25: num = 25\n",
    "    for i in range(num):\n",
    "        plt.subplot(5, 5, i + 1) \n",
    "        plt.xticks([])\n",
    "        plt.yticks([])\n",
    "        plt.grid(False)\n",
    "        plt.imshow(images[idx], cmap='binary')\n",
    "        if len(prediction) > 0:\n",
    "            title = 'labels  ' + str(prediction[idx])\n",
    "        plt.title(title, fontsize=10)\n",
    "        idx += 1\n",
    "    plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAq8AAAEwCAYAAACZuZiWAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAgAElEQVR4nO3de7zNZfr/8eu2KYft2N5Jh21/J+WQnGU0kalIqZQUEqZpKhoddDCTLx1VQpjikdRP9RgZIufIlNIwqMgpKhGajo7DkEO4f3/s3Xxd91rWXmvv9dnrc6/9ej4e+5H3OnzWtbmtffl0rftjrLUCAAAA+KBUqgsAAAAA4kXzCgAAAG/QvAIAAMAbNK8AAADwBs0rAAAAvEHzCgAAAG9437waY/YVcH+uMebTBI/5qjGmcyFq6W6MWXXc1zFjTKNEj4NghGyttDXGrDDGrM3/7yWJHgPBCNk6OcUY874xZp8xZnSiz0ewwrRW8p/7kDFmozHmC2PM5YU5BoIRtrWS//yc/PeWBwp7jFQpneoC0om19nUReV1ExBhzvojMtNauSm1VCKkdInK1tfY7Y0x9EZkvImekuCaEz0ERGSQi9fO/gKiMMfVEpKuInCcip4vIu8aYc621R1NbGUJspIjMS3URheH9mddfGGMyjTELjDGf5J/N6njc3aWNMa8ZY9YYY6YaY8rnP6epMeaD/DNf840xNaIcd4gxZn3+c4cnUFI3EflbEb8tBCAMa8Vau9Ja+11+XCciZY0xJyftm0SRhWSd7LfWLpa8JhYhFYa1IiIdRWSStfaQtXaziGwUkQuS9k0iKUKyVsQYc62IfCV5P3/8Y631+ktE9uX/t7SIVMr/dZbk/cU1IpIrIlZEfpN/33gReUBEyojIEhHJzr+9i4iMz//1qyLSWUSqicgXImL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XeeXKlRHHXLhwocrLli1T2Z0R+vrrr+Oq9RdlypSJuC0rK0tldx9StwZ3BpaZ16KpWbNm0o85bNgwlTds2BDz8S1atIiZUXINHTpU5dzcXJX5+x9+V155pcrR9lw9evRokV7D/Tnizhhu3bo14jmbN29WuXnz5iofO3asSDWhYO4+zl27dlU52l7zAwYMCLSmeMyaNSvVJcSNM68AAADwBs0rAAAAvEHzCgAAAG+Ebub10ksvjZld7du3L/CYu3fvVtmdi3XnyxK9/vTJJ58ccVvt2rVVrlOnjsrufmpnn312Qq+J4M2ZM0flhx9+WOVDhw6pXL16dZWHDBmicvny5ZNYHXzi7lftvse47xep3D8R0X3wwQcqf/755yobYyKek+g+r71791a5Xbt2KleuXFnl9957L+IYTz75ZMzXeOGFF1Tu06dPIiUiDu6fgbs/6oQJEyKek5mZGWhN0bh9iLvGo63psODMKwAAALxB8woAAABv0LwCAADAGzSvAAAA8EboPrAVhKpVq6p8ySWXxHx8QR8Si8ebb76psvuhsQYNGqjsbmKM1Fu+fLnK7ge0XF26dFH54osvTnpN8JP7QQhXdnZ2MVWCeLkfsnPfo3fs2JHwMd0L4nTu3FnlRx55ROWCPuQZ7WIsL774ospunf3791f54MGDKvft21flaBfhgTZ16lSV586dq7J7UQL3whGpMnjwYJXdD2i1adNG5SpVqgRdUtw48woAAABv0LwCAADAGzSvAAAA8EaJmHkN2rZt2yJuu/POO1W21qrsbnhfrVq15BeGhFx77bUqz58/P+bje/XqpbI7PwT8Ys2aNTHvd+cQkXo///yzyoWZcW3durXKkydPVjkrKyvxwo4TbeZ1wIABKt93330q79+/X2V37V1zzTUqcwGdgk2ZMkVl9/c4DBeCcGe4RUQmTpyocunSuiUcOHCgymGaf+bMKwAAALxB8woAAABv0LwCAADAG8y8JsGYMWMibnPnYN390WrXrh1oTYjt+++/j7htyZIlKrv7urp7cbrzQJmZmUmqDr5bunSpyq+88orKjRs3Vrlt27aB14RgRdu70/1zL+qMazzcmdXXX39d5Y8++ijwGtLdnj17VF62bFn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6jYcOGKrtrqaThzCsAAAC8QfMKAAAAb9C8AgAAwBtpN/Ma7ZrgzZs3V3ndunUqn3POOYHWhJLhpZdeUvnll19W+Q9/+EPEcwYNGhRoTUhf2dnZKr/77rsq16xZU+UhQ4aoPHHixGAKwwlVr15d5Tlz5qj817/+VeWlS5eq7M6znnrqqckrDoF57733VP72228TPsaIESNUdj+rU9Jw5hUAAADeoHkFAACAN2heAQAA4I20m3nNyMiIuO3JJ59U2b0mfZMmTQKtCenh+eefV/mRRx5RuXXr1ir36dNH5apVq0Yc86STTkpSdSjpcnJyVG7btq3Ks2bNUnn9+vUq16tXL5jCELcePXrEzPBTYT7b0L9/f5UvueSSZJWTFjjzCgAAAG/QvAIAAMAbNK8AAADwBs0rAAAAvJF2H9iK5vTTT1d5/PjxKaoEPmvVqpXK7sbTQJhMnTpV5YYNG6q8ceNGlfnAFhCMXbt2FfgY94IT9957b1DlpAXOvAIAAMAbNK8AAADwBs0rAAAAvFEiZl4BoKSpVKmSyps3b05RJUDJdt9998XMIpEXMqhRo0agNfmOM68AAADwBs0rAAAAvEHzCgAAAG8w8woAABCQfv36xcxIHGdeAQAA4A2aVwAAAHiD5hUAAADeMNba+B9szHYR2RpcOShGNa212UEcmHWSdlgriAfrBPFirSAeJ1wnCTWvAAAAQCoxNgAAAABv0LwCAADAGzSvAAAA8AbNKwAAALxB8woAAABv0LwCAADAGzSvAAAA8AbNKwAAALxB8woAAABv/H9r3j30/6XfHgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 864x1008 with 10 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "(train_images, train_labels), (test_images, test_labels) = datasets.mnist.load_data()\n",
    "plot_labels_prediction(test_images, test_labels, prediction, idx=0)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 九、交叉表查看预测数据与原数据对比\n",
    "> 对角线上的为CNN神经网络正确分类的张数，其他地方为错分的情况"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th>predict</th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "      <th>6</th>\n",
       "      <th>7</th>\n",
       "      <th>8</th>\n",
       "      <th>9</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>lables</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>967</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>1109</td>\n",
       "      <td>1</td>\n",
       "      <td>6</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>9</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1026</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>1002</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>978</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>11</td>\n",
       "      <td>0</td>\n",
       "      <td>875</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>945</td>\n",
       "      <td>0</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>6</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1019</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>957</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>11</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>989</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "predict    0     1     2     3    4    5    6     7    8    9\n",
       "lables                                                       \n",
       "0        967     2     1     0    2    0    4     1    1    2\n",
       "1          0  1109     1     6    6    0    0     4    9    0\n",
       "2          0     0  1026     0    1    0    0     4    1    0\n",
       "3          0     0     3  1002    0    1    0     4    0    0\n",
       "4          0     0     0     0  978    0    1     0    0    3\n",
       "5          1     0     0    11    0  875    1     2    1    1\n",
       "6          2     1     1     0    2    1  945     0    6    0\n",
       "7          0     0     6     1    0    0    0  1019    0    2\n",
       "8          0     1     3     2    1    2    0     2  957    6\n",
       "9          0     0     0     2   11    1    0     6    0  989"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.crosstab(test_labels, prediction, rownames=['lables'], colnames=['predict'])"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
